home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.3 KB | 134 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWIntStr.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWINTSTR_H
- #define FWINTSTR_H
-
-
- // --- International Includes ---
-
- #ifndef FWITEXT_H
- #include "FWIText.h"
- #endif
-
- // --- Foundation includes ---
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- #ifndef FWCHARAC_H
- #include "FWCharac.h"
- #endif
-
- #ifndef FWSTRS_H
- #include "FWStrs.h"
- #endif
-
- // --- OpenDoc includes ---
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- // --- Platform includes ---
-
- #ifdef FW_BUILD_MAC
- #include <Types.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // CLASS FW_CIntlString - a dynamic string that holds script and language information
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CIntlString : public FW_CString
- {
- public:
-
- FW_DECLARE_CLASS
-
- enum {kDefaultCapacity = 255};
-
- ~FW_CIntlString();
-
- FW_CIntlString(ODScriptCode scriptCode=FW_kDefaultScriptCode, ODLangCode langCode=FW_kDefaultLangCode);
- // default constructor
-
- FW_CIntlString(ODIText* iText);
-
- FW_CIntlString(const FW_CIntlString& string);
- // copy constructor
-
- FW_CIntlString(const FW_CString& string,
- ODScriptCode scriptCode=FW_kDefaultScriptCode, ODLangCode langCode=FW_kDefaultLangCode);
- // copy constructor
-
- FW_CIntlString(const FW_Char *chars, FW_CharacterCount numberChars,
- ODScriptCode scriptCode=FW_kDefaultScriptCode,
- ODLangCode langCode=FW_kDefaultLangCode);
-
- FW_CIntlString(const FW_Char *chars,
- ODScriptCode scriptCode=FW_kDefaultScriptCode,
- ODLangCode langCode=FW_kDefaultLangCode);
-
- FW_CIntlString& operator=(const FW_CIntlString& string);
- FW_CIntlString& operator=(const FW_CString& string);
-
- virtual FW_ByteCount GrowCapacity(FW_ByteCount capacityNeeded); // Override
-
- ODLangCode GetLangCode() const;
- ODScriptCode GetScriptCode() const;
-
- ODIText* CreateIText() const;
- // Allocate an ODIText and initialize its fields from this string.
-
- protected:
- void AdjustCharWidth();
- virtual FW_CharacterCount CalcLength();
-
- private:
- void AllocateRepresentation(FW_ByteCount capacity=kDefaultCapacity);
-
- ODScriptCode fScriptCode;
- ODLangCode fLanguageCode;
- };
-
- //========================================================================================
- // FW_CIntlString inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- inline void FW_CIntlString::AllocateRepresentation(FW_ByteCount capacity)
- {
- fRepresentation = new FW_Byte[capacity+FW_kMedianCharacterSize];
- fCapacity = capacity;
- }
-
- //----------------------------------------------------------------------------------------
- inline ODScriptCode FW_CIntlString::GetScriptCode() const
- {
- return fScriptCode;
- }
-
- //----------------------------------------------------------------------------------------
- inline ODLangCode FW_CIntlString::GetLangCode() const
- {
- return fLanguageCode;
- }
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-